#define _CRT_SECURE_NO_WARNINGS 1

#include"SList.h"

void TestSList1()
{
	SLTNode* plist = NULL;
	SLPushFront(&plist, 1);
	SLPushFront(&plist, 2);
	SLPushFront(&plist, 3);
	SLPushFront(&plist, 4);

	SLTPrint(plist);
}

void Swapi(int* p1, int* p2)
{
	int tmp = *p1;
	*p1 = *p2;
	*p2 = tmp;
}

void Swappi(int** pp1, int** pp2)
{
	int* tmp = *pp1;
	*pp1 = *pp2;
	*pp2 = tmp;
}

void TestSList2()
{
	SLTNode* plist = NULL;
	SLPushBack(&plist, 123);
	SLPushBack(&plist, 23);
	SLPushFront(&plist, 1);
	SLPushFront(&plist, 2);
	SLPushFront(&plist, 3);
	SLPushFront(&plist, 4);
	SLPushBack(&plist, 223);
	SLTPrint(plist);
	SLPopBack(&plist);
	SLTPrint(plist);
	SLPopBack(&plist);
	SLTPrint(plist);
	SLPopBack(&plist);
	SLTPrint(plist);
	SLPopBack(&plist);
	SLTPrint(plist);
	SLPopBack(&plist);
	SLPopBack(&plist);
	SLPopBack(&plist);

	SLTPrint(plist);
}

void TestSList3()
{
	SLTNode* plist = NULL;
	SLPushBack(&plist, 123);
	SLPushBack(&plist, 23);
	SLPushFront(&plist, 1);
	SLPushFront(&plist, 2);
	SLPushFront(&plist, 3);
	SLPushFront(&plist, 4);
	SLTPrint(plist);
	SLPopFront(&plist);
	SLTPrint(plist);
	SLPopFront(&plist);
	SLTPrint(plist);
	SLPopFront(&plist);
	SLTPrint(plist);
	SLPopFront(&plist);
	SLTPrint(plist);
	SLPopFront(&plist);
	SLTPrint(plist);
	SLPopFront(&plist);
	SLTPrint(plist);
}

int main()
{
	//TestSList1();

	TestSList3();

	//int a = 0, b = 1;
	//Swapi(&a, &b);

	//int* px = &a, * py = &b;
	//Swappi(&px, &py);

	return 0;
}